package org.millioncall.yueyoga.admin.service.impl;

import java.util.Map;

import org.millioncall.yueyoga.admin.dao.EarlyExperienceDAO;
import org.millioncall.yueyoga.admin.model.EarlyExperience;
import org.millioncall.yueyoga.admin.service.EarlyExperienceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EarlyExperienceServiceImpl implements EarlyExperienceService {
	private static final Logger logger = LoggerFactory.getLogger(EarlyExperience.class);
	private EarlyExperienceDAO earlyExperienceDAO;

	public EarlyExperienceDAO getEarlyExperienceDAO() {
		return earlyExperienceDAO;
	}

	public void setEarlyExperienceDAO(EarlyExperienceDAO earlyExperienceDAO) {
		this.earlyExperienceDAO = earlyExperienceDAO;
	}

	@Override
	public void deleteExperienceByMemberIds(Integer[] deids) {
		if(deids == null || deids.length == 0) {
			logger.error("未提交要删除演讲者的编号");
			throw new RuntimeException(" 未提交要删除演讲者的编号");
		} else {
			this.earlyExperienceDAO.deleteByIds(deids);
		}
	}

	@Override
	public boolean saveEarlyExperience(EarlyExperience earlyExperience) {
		int i=earlyExperienceDAO.insert(earlyExperience);
		if(i>0){
			return true;
		}else{
			return false;
		}
	}

	@Override
	public boolean updateEarlyExperience(Map<String, Object> map) {
		int i=earlyExperienceDAO.update(map);
		if(i>0){
			return true;
		}else{
			return false;
		}
	}

}
